import numpy as np
import cv2 as cv
from matplotlib import pyplot as plt
import matplotlib
matplotlib.rcParams['font.family'] = 'SimHei' #中文显示
import numpy as np
import cv2 as cv

# 1 读取图像
img = cv.imread('../imgs/horse.jpg',0)
# 2 laplacian转换:拉布拉斯检测
result = cv.Laplacian(img,cv.CV_16S)
Scale_abs = cv.convertScaleAbs(result)
# 3 图像展示
plt.figure(figsize=(10,8),dpi=100)
plt.subplot(121),plt.imshow(img,cmap=plt.cm.gray),plt.title('原图')
plt.xticks([]), plt.yticks([])
plt.subplot(122),plt.imshow(Scale_abs,cmap = plt.cm.gray),plt.title('Laplacian检测后结果')
plt.xticks([]), plt.yticks([])
plt.show()
